<!-- ! 仅用于测试-->
<html>

<head>
  <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  <title>bilibili-parse播放测试</title>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.css">
</head>

<body>
  <div id="dplayer1"></div>
</body>
<script src="https://cdn.jsdelivr.net/npm/flv.js/dist/flv.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/dplayer/dist/DPlayer.min.js"></script>

<script>
  let av, p, q
  const query_arr = window.location.search.substring(1).split('&')
  for (let i = 0; i < query_arr.length; i++) {
    const pair = query_arr[i].split('=')
    if (pair[0] == 'av') {
      av = pair[1]
    } else if (pair[0] == 'p') {
      p = pair[1]
    } else if (pair[0] == 'q') {
      q = pair[1]
    }
  }
  p = p || '1'
  q = q || '32'
  const dp = new DPlayer({
    container: document.getElementById("dplayer1"),
    video: {
      url: `flv.php?av=${av}&p=${p}&q=${q}`,
      type: 'customFlv',
      customType: {
        customFlv: function (video, player) {
          const flvPlayer = flvjs.createPlayer({
            type: 'flv',
            url: video.src
          })
          flvPlayer.attachMediaElement(video)
          flvPlayer.load()
        }
      }
    }
  })
</script>

</html>
